<?php
/*
	获取活动详情
	电商客商品列表页和商品详情页会调用本方法以获得商品详情
*/
defined('BY_JYA') or exit('error');
list($message,$return)=$arguments;
		$openid=$message['FromUserName'];
		$m=pdo_get('core_fans',array('openid'=>$openid));
		$member['nickname']=$m['nickname'];
		$member['avatar']=$m['avatar'];
		$item=pdo_get('jy_poster_poster',array('id'=>$return['key'],'uniacid'=>$_SESSION['uniacid']));
		$data=json_decode($item['data'],true);
		$poster['id']=$item['id'];
		$poster['data']=$data['data'];
		$poster['bg']=$data['image'];
		if($item['type']==1){
			$url=custom_url('jy_weishop/index//fromuser='.$m['mid'],true);
		}elseif($item['type']==2){
			$url=custom_url('jy_weishop/merch//fromuser='.$m['mid'].'&uid='.$m['mid'],true);
		}elseif($item['type']==3){
			$url=custom_url('jy_weishop/goods.detail//fromuser='.$m['mid'].'&id='.$goodsid,true);
		}elseif($item['type']==4){
			$url=custom_url('jy_commission/myshop/main/fromuser='.$m['mid'].'&mid='.$m['mid'],true);
		}elseif($item['type']==5){
			$url=custom_url($item['ewmurl'].'&fromuser='.$m['mid'],true);
		}
		if($item['type']==6){
			$qr=$this->model('model')->get_subscribeqr($item);
		}else{	
			$qr=cfc('tools')->createqrcode($url,150,true);
		}
		$img=$this->model()->createPoster($poster,$qr,$member);
		$data=array('msgtype'=>'image','touser'=>$openid,'image'=>array('media_id'=>$media,'content'=>'','url'=>$img));
		unlink($img);
		$waittext=$item['waittext']?:'您的专属海报正在拼命生成中，请等待片刻...';
		if(!$item['id']){
			$waittext='生成专属海报失败！请检查公众号设置。';
		}
		cfc('account')->send_text($waittext,$m['mid']);
		if($item['id']){
			$buildurl=custom_url('jy_poster/build//posterid='.$item['id'],true);
			$posterurl='<a href="'.$buildurl.'">点击查看您的专属海报</a>';
			cfc('account')->send_text($posterurl,$m['mid']);
		}